package com.septagon.wildtunnel.model;

import java.util.List;

import android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;



public class ThreadViewAdapter extends ArrayAdapter<Res> {
	private LayoutInflater layoutInflater_;

	public ThreadViewAdapter(Context context, int resource, List<Res> objects) {
		super(context, resource, objects);
		layoutInflater_ = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		 Res item = (Res)getItem(position);
		 
		 if (null == convertView) {
			 convertView = layoutInflater_.inflate(com.septagon.wildtunnel.R.layout.thread_view_item, null);
		 }
		 
		 TextView infoText;
		 infoText = (TextView)convertView.findViewById(com.septagon.wildtunnel.R.id.infoView);
		 String resText = item.getIndex() + " " + item.getName() + " [" + item.getMail() + "] " + item.getId() + "" + item.getDate() + " " + item.getBe();
		 infoText.setText(resText);
		 
		 TextView resView;
		 resView = (TextView) convertView.findViewById(com.septagon.wildtunnel.R.id.messageView);
		 resView.setText(item.getMessage());
		 
		 return convertView;
	}
}

